package file;

import java.io.File;

/**
 *java.io.file
 */
public class FileDemo {
    public static void main(String[] args) {
        File file = new File("./Demo.txt");
        //获取文件大小，单位是字节
        long len = file.length();
        System.out.println(len+"个字节");
        //获取名字
        String name = file.getName();
        System.out.println("文件名字："+name);
        //是否可读
        boolean cr = file.canRead();
        //是否可写
        boolean cw = file.canWrite();
        System.out.println("可读："+cr);
        System.out.println("可写："+cw);
        //是否隐藏
        boolean ih = file.isHidden();
        System.out.println("是否隐藏："+ih);
    }
}
